# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-kwconfig
pkgname=('python2-kwconfig' 'python-kwconfig')
_pkgname=kwconfig
pkgver=1.1.7
pkgrel=7
pkgdesc='A Python module for managing config files in keyword style json format.'
arch=('any')
url='https://pypi.org/project/kwconfig/#files'
license=('MIT')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('039f2cf3bed0ab96fc9475f088d469d55a8ccb8b54e38162692ee1556d9be7c4c3df1fcb006d5d6a4c4ff3fbdd15d2b9918ecb29effbcf7493e4c6742e3d9bde')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-kwconfig() {
  depends=('python2' 'python2-argparse')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
	--skip-build
}

package_python-kwconfig() {
  depends=('python' 'python-argparse')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
	--skip-build
}

